﻿using System;
using System.Globalization;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace Organizer.Views.Converters
{
    public class ManageSelectionStateToVisibilityConverter : IValueConverter
    {
        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var state = (Organizer.ViewModel.BaseViewModel.State)value;
            if (targetType.Name == typeof(System.Windows.Visibility).Name)
                switch (state)
                {
                    case Organizer.ViewModel.BaseViewModel.State.Edit:
                        return Visibility.Collapsed;
                    case Organizer.ViewModel.BaseViewModel.State.ManageSelection:
                        return Visibility.Visible;
                    case Organizer.ViewModel.BaseViewModel.State.Normal:
                        return Visibility.Collapsed;
                    default:
                        return Visibility.Collapsed;
                }
            if (targetType.Name == typeof(System.Boolean).Name)
                switch (state)
                {
                    case Organizer.ViewModel.BaseViewModel.State.Edit:
                        return false;
                    case Organizer.ViewModel.BaseViewModel.State.ManageSelection:
                        return true;
                    case Organizer.ViewModel.BaseViewModel.State.Normal:
                        return false;
                    default:
                        return false;
                }
            return null;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
